/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/16 18:30
  *
  * @file       pd_timer_ch.h
  * @brief      Header file of timer channel hardware driver.
  *
  * @note       This file contains the timer channel object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/16     Chris        the first version
  *
  ******************************************************************************
  */


#ifndef JLC_SKY_TIMER_CH_H
#define JLC_SKY_TIMER_CH_H

#include "pd_gpio.h"

struct TimerChVtbl;

/** @defgroup Object properties
  * @{
  */
typedef struct {
    GPIO *gpios;
    uint8_t gpioSize;

    uint32_t *channels;
    uint8_t chSize;

    // TimerCh virtual table
    struct TimerChVtbl *vptr;
} TimerCh;

/**
 * @}
 */

/** @defgroup Object virtual table definition
  * @{
  */
struct TimerChVtbl {
    void (*init)(const TimerCh *this);
};

/**
 * @}
 */

/** @defgroup Object constructor and member function declaration
  * @{
  */
void TimerCh_constructor(TimerCh *this, GPIO *gpios, uint8_t gpioSize, uint32_t *channels, uint8_t chSize);

/**
 * @}
 */

/** @defgroup Object virtual table function implementation
  * @{
  */
static inline void TimerCh_init(const TimerCh *this) {
    this->vptr->init(this);
}

/**
 * @}
 */

#endif //JLC_SKY_TIMER_CH_H
